﻿using Ebusiness_OrderService.Register;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ebusiness_Framework.Consul
{
    public static class RegisterCenterServiceCollectionExtentions
    {
        /// <summary>
        /// 添加服务
        /// </summary>
        /// <param name="serviceDescriptors"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static IServiceCollection AddRegisterCenter(this IServiceCollection Services, IConfiguration configuration)
        {
            Services.AddHealthChecks();
            Services.AddHostedService<ServiceRegisterHostService>();
            Services.Configure<ServiceRegisteryOption>(configuration.GetSection("ConsulRegistery"));
            return Services;
        }
    }
}
